<template>
  <div class="good-order app-wrapper">
      <div class="tab tab-filter">
        <div class="tab-header">
          <ul class="clearfix">
            <li class="tab-header-item active">全部订单</li>
            <li class="tab-header-item">未付款</li>
            <li class="tab-header-item">已付款</li>
            <li class="tab-header-item">已发货</li>
            <li class="tab-header-item">已验收</li>
          </ul>
        </div>
        <div class="tab-body ">
            <div class="user-info text-right clearfix">
                <h5 class="pull-left name">名人字画私人订制</h5><a href="#" status>未付款</a>
            </div>
            <ul class="order-list">
                <li 
                    v-for="item in goodsList"
                    :key="item.id"
                >
                    <router-link to="/goodscar" class="media clearfix">
                        <div class="media-object pull-left"><img :src="item.url" alt=""></div>
                        <div class="media-body over-hidden">
                            <h4 class="media-heading">{{item.name}}</h4>
                            <p class="media-desc"><span class="line-through">￥{{item.origin}}</span></p>
                             <div class="media-footer clearfix">
                                <span class="pull-left">￥{{item.price}}</span>
                                <span>X{{item.price}}</span>
                            </div>
                        </div>
                    </router-link>
                </li>
            </ul>
            <!-- /order-list -->
            <div class="counts text-right">
                <p class="info">共{{totalNums}}件商品 合计：¥{{totalPrice}}(含运费¥30)</p>
                <p class="button-groups">
                    <button type="button" class="button button-out-line">取消订单</button>
                    <button type="button" class="button button-out-line">修改地址</button>
                    <button type="button" class="button button-out-line red">去付款</button>
                </p>
            </div>
        </div>
      </div>
  </div>
</template>

<script>
const imgUrl = require("./img/goods_2.png");
export default {
  components: {},
  props: {},
  data() {
    return {
        shipping: 30,
        goodsList: [
            {id: 1, name: '作品名称: 山里云中歌', origin: '4500', price: '3500', nums: 1, url: imgUrl, isChecked: false},
            {id: 2, name: '作品名称: 山里云中歌', origin: '4500', price: '3500', nums: 1, url: imgUrl, isChecked: false},
            {id: 3, name: '作品名称: 山里云中歌', origin: '4500', price: '3500', nums: 1, url: imgUrl, isChecked: false}
        ]
    };
  },
  computed: {
    totalNums(){
        return this.goodsList.reduce((total, item)=>{
            return total += item.nums;
        }, 0);
    },
    totalPrice(){
        return this.goodsList.reduce((total, item)=>{
            return total += parseFloat(item.price);
        }, this.shipping);
    },
  },
  methods: {},
  created() {},
  mounted() {}
};
</script>
<style lang="scss" scoped>
$red:#e24241;
.goods-wrapper {
  padding: 20px 35px 0;
  background: #fff;
}

.tab-filter {
    .tab-header{
        padding: 0 35px;
        margin-bottom: 15px;
        background-color: #fff;
        > ul{ display: flex; }

    }
    .tab-header-item {
        flex: 1;
        text-align: center;
        font-size: 30px;
        line-height: 90px;
        color: #2a2a2a;
        position: relative;

    &.active{
      color: $red;
      &:after {
        content: '';
        display: block;
        width: 100%;
        height:4px;
        position: absolute;
        bottom: 0;
        left: 0;
        background-color: $red;
      }
    }
  }


  .tab-body {
    padding: 0 35px;
    background-color: #fff;
  }
}

.user-info {
    height: 80px;
    border-bottom: 1px solid #ccc;
    font-size: 28px;
    line-height: 80px;
    color: #2a2a2a;
    position: relative;
    &:after {
        display: block;
        content: '';
        position: absolute;
        left: 35px;
        right: 35px;
        bottom: 0;
    }

    > a {
        color: $red;
    }
}


.order-list  {
    padding: 0 35px;

    .media {
        display: block;
        padding: 25px 0;
        position: relative;
        &::before {
            content: '';
            display: block;
            width: 100%;
            height: 2px;
            background-color: #f0f0f0;
            position: absolute;
            left: 0;
            bottom: 0;
        }
    }
    .media-object {
        width: 200px;
        height: 154px;
        margin-right: 20px;
    }
    .media-heading {
    font-size: 28px;
    line-height: 45px;
    color: #2a2a2a; 
    }

    .media-footer {
        font-size: 0;
        height: 60px;
        line-height: 60px;
        text-align: right;
        span {
            font-size: 30px;
            color: $red;
        }

        .button {
            display: inline-block;
            width: 136px;
            height: 60px;
            margin-left: 10px;
            font-size: 24px;
            line-height: 60px;
            text-align: center;
            border-radius: 4px;
            &.button-fill{
                color: #fff;
                background-color: $red;
            }

            &.button-outline {
                border: 2px solid $red;
                color: $red;
                background-color: #fff;
            }
        }        
    }

    .media-desc {
        font-size: 24px;
        line-height: 2;
        span {
            color: #888;
            text-decoration: line-through;
        }
    }
}

.counts {
    padding: 30px 0 40px;
    .info {
        margin-bottom: 16px;
        font-size: 24px;
        line-height: 48px;
        color: #666;
    }

    .button-groups { font-size: 0; }
    .button {
        width: 120px;
        height: 48px;
        margin-left: 20px;
        font-size: 24px;
        line-height: 48px;
        text-align: center;
        color: #666;
        &.button-out-line {
            border: 1px solid #666;
            background: #fff;
        }
        &.red {
            border-color: $red;
            color: $red;
        }
    }
}
</style>